package controller

import (
	"context"
	"github.com/SupenBysz/gf-admin-company-modules/co_interface"
	"github.com/SupenBysz/tt-demo/api"
	logic "github.com/SupenBysz/tt-demo/internal/logic/school"
)

type SchoolController struct {
	Logic *logic.SchoolLogic
}

var School = func(modules co_interface.IModules) *SchoolController {
	return &SchoolController{
		logic.NewSchoolLogic(modules),
	}
}

func (c *SchoolController) GetModules() co_interface.IModules {
	return c.Logic.Modules
}

func (c *SchoolController) CreateStudent(ctx context.Context, req *api.CreateMemberReq) (*api.ApiRes, error) {
	return c.Logic.CreateStudent(ctx, req)
}

func (c *SchoolController) CreateTeacher(ctx context.Context, req *api.CreateMemberReq) (*api.ApiRes, error) {
	return c.Logic.CreateTeacher(ctx, req)
}

func (c *SchoolController) QueryMemberById(ctx context.Context, req *api.QueryMemberByIdReq) (*api.ApiRes, error) {
	return c.Logic.QueryMemberById(ctx, req)
}

func (c *SchoolController) CreateExamination(ctx context.Context, req *api.CreateExaminationReq) (*api.ApiRes, error) {
	return c.Logic.CreateExamination(ctx, req.Examination)
}

func (c *SchoolController) QueryExaminationByName(ctx context.Context, req *api.QueryExaminationByNameReq) (*api.ApiRes, error) {
	return c.Logic.QueryExaminationByName(ctx, req)
}